﻿using AE_BEPUPhysics_Addition;
using UnityEngine;
using UnityEngine.Events;

namespace GameLogic
{
    public class FightLogicStrategy
    {
        public enum StrategyType
        {
            Offline,
            Online
        }
        protected UnityEvent m_OnLogicComplete = new UnityEvent();
        float m_TimeCount = 0;
        protected StrategyType m_StrategyType = StrategyType.Offline;

        public StrategyType MStrategyType
        {
            get => m_StrategyType;
        }
        public UnityEvent OnLogicComplete
        {
            get => m_OnLogicComplete;
            set => m_OnLogicComplete = value;
        }

        public virtual void Init()
        {
        }

        public virtual void Update()
        {
            m_TimeCount += Time.deltaTime;
            if (m_TimeCount > SystemModule.Instance.m_LogicDelta.ToFloat())
            {
                OnLogicTime();
                m_TimeCount = 0;
            }
        }

        public virtual void Clear()
        {
            OnLogicComplete.RemoveAllListeners();
        }

        public virtual void OnLogicTime()
        {
            
        }
        public virtual int GetControlShipID()
        {
            return 1;
        }

        public virtual void SetControlShipID(int value)
        {
        }

        public virtual void OnFireChanged(bool value)
        {
        }

        public virtual void OnAimPositionChanged(Vector2Int pos)
        {
        }

        public virtual void OnFocusPositionChanged(Vector2Int pos)
        {
        }

        public virtual void OnMoveDirChanged(Vector2Int pos)
        {
        }
    }
}